<template>
    <div>
    <el-dialog title="调用链" :width="width"
             :visible.sync="isShowVisible"
             center :close-on-click-modal="true"
             :before-close="() => this.close()">
      <el-card style="margin-top: 10px">
        <el-table border :data="dataList" v-loading="tableLoading">
          <el-table-column label="序号" width="50" prop="fseq" align="center"></el-table-column>
          <el-table-column label="节点类型" width="100" prop="fnodetype" align="center"></el-table-column>
          <el-table-column label="节点KEY" width="100" prop="fnodekey" align="center"></el-table-column>
          <el-table-column label="执行结果" width="100" align="center">
            <template slot-scope="scope">
              <el-tag v-if="scope.row.fstatus==1" type="success">成功</el-tag>
              <el-tag v-if="scope.row.fstatus==0" type="danger">失败</el-tag>
            </template>
          </el-table-column>
          <el-table-column label="创建时间" width="160" prop="fcreatetime" align="center"></el-table-column>
          <el-table-column label="输入" prop="fin" align="center"></el-table-column>
          <el-table-column label="输出" prop="fout" align="center"></el-table-column>
          <el-table-column label="错误信息" prop="ferror" align="center" show-overflow-tooltip></el-table-column>
          <el-table-column label="操作" width="80" align="center">
            <template slot-scope="scope">
              <el-button type="text" @click="openView(scope.row.fid)">查看</el-button>
            </template>
          </el-table-column>
        </el-table>
      </el-card>
    </el-dialog>
    <flowlogDetailView v-if="isShowView" :fid="subFid" @close="closeSub"></flowlogDetailView>
    </div>
</template>

<script>
  import LogBaseApi from '@/api/module/LogBaseApi'
  export default {
    name: 'flowlog_detail',
    components:{
      flowlogDetailView: resolve => require(['./flowlog_detail_view'], resolve),
    },
    props:{
      width : {type : String , default : '95vw'},
      fid : {type : Number},
    },
    data(){
      return{
        isShowVisible : true,
        tableLoading : false,
        isShowView : false,
        dataList : [],
        api : new LogBaseApi(),
        subFid : null,
      }
    },
    created(){
      this.getData()
    },
    methods:{
      openView(id){
        this.subFid = id
        this.isShowView = true
      },
      closeSub(){
        this.subFid = null
        this.isShowView = false
      },
      close(){
        this.$emit('close')
      },
      getData(){
        this.tableLoading = true
        let data = {
          fparentid : this.fid,
          pageSize : 100,
          page : 1,
        }
        this.api.queryDetailListPage(data).then(res => {
          this.dataList = res.data.rows
          this.tableLoading = false
        })
      },
    },
  }
</script>
<style scoped>
</style>
